﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MvcBase
{
    public class BaseGenerics
    {
        #region Generic with class
        public class Couple<T, E>
        {
            public T elementA;
            public E elementB;
            public Couple(T inA, E inB)
            {
                elementA = inA;
                elementB = inB;
            }
            public T ElementA
            {
                get { return elementA; }
                set { elementA = value; }
            }
        }

        public class Triple<T, E, F>
        {
            public T elementA;
            public E elementB;
            public F elementC;
            public Triple(T inA, E inB, F inC)
            {
                elementA = inA;
                elementB = inB;
                elementC = inC;
            }
        }

        public class Quad<T, E, F, G>
        {
            public T elementA;
            public E elementB;
            public F elementC;
            public G elementD;
            public Quad(T inA, E inB, F inC, G inD)
            {
                elementA = inA;
                elementB = inB;
                elementC = inC;
                elementD = inD;
            }
        }
        #endregion

        #region Generic with Function
        public string toString<T>(List<Couple<string, T>> list)
        {
            string result = "";
            foreach (Couple<string, T> pair in list)
            {
                string tmp = pair.elementA + " : " + pair.elementB.ToString();
                result += tmp + '\n';
            }
            return result;
        }
        #endregion
        
    }
}
